package com.servicesystem.servicesystem.controller.douyin;

import com.servicesystem.servicesystem.entity.douyin.vo.oauth.OauthVO;
import com.servicesystem.servicesystem.service.OauthService;
import com.servicesystem.servicesystem.untis.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author X
 * @version 1.0
 * @ClassName OauthController
 * @description
 * @date 2020/9/8
 **/
@RestController
@RequestMapping("/douyin/oauth")
public class OauthController {

    @Autowired
    private OauthService oauthService;

    /***
     * 自用型授权获取access_token
     * @return
     */
    @GetMapping("/getAccessToken")
    public R getAccessToken() throws Exception {
        OauthVO oauthVO = oauthService.getAccessToken();
        return R.success(oauthVO);
    }

    /***
     * 获取店铺的已授权品牌列表
     * @return
     */
    @GetMapping("/getBrandList")
    public R getBrandList() throws Exception {
        String result = oauthService.getBrandList();
        return R.success(result);
    }
}
